<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>登录页面</title>
    <style>
        body {
            font-family: "Microsoft YaHei", Arial, sans-serif;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            height: 100vh;
            margin: 0;
            background: linear-gradient(120deg, #2980b9, #8e44ad);
            color: #333;
        }
        .system-title {
            color: white;
            text-align: center;
            font-size: 42px;
            margin-bottom: 40px;
            font-weight: bold;
            text-shadow: 0 0 10px rgba(255,255,255,0.3),
                        0 0 20px rgba(255,255,255,0.3),
                        0 0 30px rgba(255,255,255,0.3);
            letter-spacing: 4px;
            animation: glow 1.5s ease-in-out infinite alternate;
        }

        @keyframes glow {
            from {
                text-shadow: 0 0 10px rgba(255,255,255,0.3),
                            0 0 20px rgba(255,255,255,0.3),
                            0 0 30px rgba(255,255,255,0.3);
            }
            to {
                text-shadow: 0 0 20px rgba(255,255,255,0.5),
                            0 0 30px rgba(255,255,255,0.5),
                            0 0 40px rgba(255,255,255,0.5);
            }
        }
        .login-container {
            background: rgba(255, 255, 255, 0.95);
            padding: 30px 40px;
            border-radius: 15px;
            box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
            width: 300px;
            backdrop-filter: blur(10px);
        }
        .login-container h2 {
            text-align: center;
            margin-bottom: 20px;
            color: #2c3e50;
            font-size: 28px;
            font-weight: 600;
        }
        .login-container input {
            width: 80%;
            padding: 12px 15px;
            margin: 15px 0;
            border: 2px solid #e3e3e3;
            border-radius: 8px;
            font-size: 16px;
            transition: all 0.3s ease;
            display: block;
            margin-left: auto;
            margin-right: auto;
        }
        .login-container input:focus {
            border-color: #3498db;
            outline: none;
            box-shadow: 0 0 8px rgba(52, 152, 219, 0.3);
        }
        .login-container button {
            width: 80%;
            padding: 12px;
            background: linear-gradient(to right, #3498db, #2980b9);
            border: none;
            color: white;
            border-radius: 8px;
            cursor: pointer;
            font-size: 16px;
            font-weight: 600;
            margin-top: 10px;
            display: block;
            margin-left: auto;
            margin-right: auto;
            transition: all 0.3s ease;
        }
        .login-container button:hover {
            background: linear-gradient(to right, #2980b9, #3498db);
            transform: translateY(-2px);
            box-shadow: 0 5px 15px rgba(52, 152, 219, 0.4);
        }
        .link {
            text-align: center;
            margin-top: 20px;
        }
        .link a {
            color: #3498db;
            text-decoration: none;
            font-weight: 500;
            transition: all 0.3s ease;
        }
        .link a:hover {
            color: #2980b9;
            text-decoration: none;
        }
        @keyframes slideDown {
            from {
                transform: translate(-50%, -100%);
                opacity: 0;
            }
            to {
                transform: translate(-50%, 0);
                opacity: 1;
            }
        }
    </style>
</head>
<body>
    <div class="system-title">图像预处理系统</div>
    <div class="login-container">
        <h2>欢迎登录</h2>
        <form id="loginForm">
            <input type="text" id="username" placeholder="请输入用户名" required>
            <input type="password" id="password" placeholder="请输入密码" required>
            <button type="submit">立即登录</button>
        </form>
        <div class="link">
            <p>还没有账号？ <a href="/register">立即注册</a></p>
        </div>
    </div>

    <script>
        const loginForm = document.getElementById("loginForm");

        loginForm.onsubmit = function(event) {
            event.preventDefault();

            const username = document.getElementById("username").value;
            const password = document.getElementById("password").value;

            const correctUsername = "admin";
            const correctPassword = "admin";

            if (username === correctUsername && password === correctPassword) {
                window.location.href = "/home";
            } else {
                const alertDiv = document.createElement('div');
                alertDiv.style.cssText = `
                    position: fixed;
                    top: 20px;
                    left: 50%;
                    transform: translateX(-50%);
                    background-color: #ff4444;
                    color: white;
                    padding: 15px 30px;
                    border-radius: 5px;
                    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
                    animation: slideDown 0.5s ease-out;
                `;
                alertDiv.textContent = "用户名或密码错误，请重新输入！";
                document.body.appendChild(alertDiv);

                setTimeout(() => {
                    alertDiv.remove();
                }, 3000);
            }
        }
    </script>

</body>
</html>
